import unittest
import movement
import world

class MovementTest(unittest.TestCase):
    """Test case for the 'movement' module"""
    
    def test_translate(self):
        coordinates = (1, 1)
        
        expected = [(1, 0), (0, 1), (1, 2), (2, 1)]
        directions  = [movement.NORTH, movement.WEST, movement.SOUTH,
                       movement.EAST]
        
        for i in range(len(expected)):
            e = expected[i]
            d = directions[i]
            translated = movement.translate(d, coordinates)
            self.assertEqual(e, translated)
    
    def test_get_route(self):
        coordinates = (1, 1)
        w  = world.World()
        w.populate()
        
        expecteds = [(1, 0), (0, 1), (1, 2), (2, 1)]
        directions  = [movement.NORTH, movement.WEST, movement.SOUTH,
                       movement.EAST]
        
        for i in range(len(expecteds)):
            e = expecteds[i]
            d = directions[i]
            r = w.get_route(coordinates[0], coordinates[1], e[0], e[1])
            route = movement.get_route(w, d, coordinates)
            self.assertEqual(r, route)
        
        
    


if __name__ == '__main__':
    unittest.main()
    
def get_suite():
    return unittest.makeSuite(MovementTest)
